1. Field of the Invention
The present invention relates to an image compression controller applied, for example, for a digital still camera system and compressing image data to generate an image file of a size of not more than a set size and an image pickup system using the same.
2. Description of the Related Art
Compression based on for example the Joint Photographic Experts Group (JPEG) standard of still images may be roughly divided into generally the four processes in order: discrete cosine transform (DCT) processing; quantization; entropy coding; and JPEG file formatting.
Here, the DCT circuit performs orthogonal transform processing applying two-dimensional DCT on original image data to remove the spatial relationship, focusing the energy on some coefficients, and compressing and coding so-called redundancy.
The quantization approximates the data with the compressed redundancy at a discrete level.
The entropy coding assigns codes for every quantization output so that the average code length becomes short.
The JPEG file formatting produces a JPEG file of a size of not more than a set size from the entropy coded data.
The final JPEG data is obtained by all these processings, so the data size is found after completing the processing.
Also, the JPEG data size, or the compression rate, changes in accordance with the control of a quantization coefficient in the quantization stage.
Controlling the JPEG data size to be a desired size becomes possible by repeatedly performing the above processing while changing the quantization coefficient.
However, the method of controlling the JPEG data size to be a desired size by changing the quantization coefficient requires a long processing time.
Especially, in a digital still camera system etc., since the capacity of the storage medium for storing the JPEG file is limited, when compressing a photographed still image, control is required so that the final JPEG data does not become larger than a certain size.
Accordingly, a digital still camera system etc. is provided with an image compression controller for changing the quantization coefficient by for example an image quality mode so as to control the size of the JPEG data.
FIG. 13 is a block diagram of an example of the configuration of this type of image compression controller.
An image compression controller 10 comprises a DCT circuit 11, a quantization circuit 12, an entropy coding circuit 13, a size measurement circuit 14, a quantization coefficient control circuit 15, a quantization table 16 stored in a storage circuit, and a JPEG file maker 17.
In the DCT circuit 11 of the image compression controller 10, as shown in FIG. 14, a discrete cosine transform on is performed with respect to the input original image data and the result is output as data D11 to the quantization circuit 12 (ST1, ST2).
In the quantization circuit 12, the data D11 based on a quantization coefficient S15 given by the quantization coefficient control circuit 15 is quantized (ST3) and the result is output as data D12 to the entropy coding circuit 13.
At this time, the quantization coefficient given by the quantization coefficient control circuit 15 is given by selecting a coefficient having a low compression rate at the time of initialization from the quantization table 16.
In the entropy coding circuit 13, codes are assigned to the quantization data D12 so that the average code length becomes short (ST4) and the result is output as data D13 to the size measurement circuit 14 and the JPEG file maker 17.
In the size measurement circuit 14, the size of the entropy coded data D13 (ST5) is measured and the measured size is output as a signal S14 to the quantization coefficient control circuit 15.
In the quantization coefficient control circuit 15, the signal S14 is received and the judgement is performed whether the entropy coded data size is less than a set predetermined size (ST6).
When the quantization coefficient control circuit 15 judges that the entropy coded size is larger than the set size at step ST6, a signal S15a indicating the judgement is output to the JPEG file maker 17, selected a quantization coefficient which gives a little higher compression rate than that at first from the quantization table 16, and this is given to the quantization circuit 12 (ST7). At this time the JPEG file maker 17 does not make a file.
The processing of steps ST1 to ST7 is then repeated until it is judged at step ST6 that the entropy coded data size is less than the set size.
In this repeated processing, the compression is performed while changing the quantization coefficient for each repetition, The quantization coefficient is selected and given to the quantization circuit 12 so that the compression rate becomes gradually higher.
When judging at step ST6 that the entropy coded data size is less than the set size, a signal S15a indicating the judgement is output to the JPEG file maker 17 by the quantization coefficient control circuit 15.
Then, in the JPEG file maker 17, a JPEG file based on the entropy coded compression image data D13 of the size less than the set size is made and output (ST8).
Summarizing the problem to be solved by the invention, in the above image compression controller, due in part to the fact that the compression rate ends up becoming higher than necessary depending on the input image data, when trying to flexibly change the quantization coefficient for every image in order to obtain a better image quality within the limited capacity, the processing process increases due to the repetition of compression as explained above etc. and the processing time ends up increasing as well along with the number of repetitions.
Further, since the number of repetitions differs in accordance with an input image, the processing time is liable to end up becoming uneven.
Especially, entropy coding generally requires a long processing time, so repetition of the processing many times has a large effect on the overall processing time.
Also, even if increasing the clock frequency or tinkering with the circuit configuration so as to increase the speed of processing of each block, the processing is wasted the more the number of repetitions and is difficult to make the best use of the improved performance.
An object of the present invention is to provide an image compression controller capable of simplifying the quantization coefficient control in an image compression process and increasing the speed of image compression and an image pickup system using the same.
According to a first aspect of the present invention, there is provided an image compression controller for compressing image data to generate an image file having a size smaller than a set size, comprising a compression circuit for compressing redundancy of input image data for coding; a quantization circuit for first quantization based on a first quantization coefficient and second quantization based on a second quantization coefficient on an output signal of the compression circuit; a counter for counting the number of a quantization value having correlation with a size of an image file generated among quantization values included at least in first quantization data from the quantization circuit; a quantization coefficient control circuit for generating a control coefficient based on the count of the counter and a reference value of a quantization value having correlation with a size of an image file generated set in advance; a quantization coefficient generation circuit for supplying a reference quantization coefficient set in advance as the first quantization coefficient to the quantization circuit, generating the second quantization coefficient based on the control coefficient and the reference quantization coefficient, and supplying the same to the quantization circuit when a control coefficient from the quantization coefficient control circuit is received; and an entropy coding circuit for entropy coding on the second quantization data from the quantization circuit.
Preferably, the counter further counts the number of a quantization value having correlation with the size of the image file generated among quantization values included in the second quantization data from the quantization circuit; the quantization coefficient control circuit again generates a control coefficient based on the number of a quantization value having correlation with the size of the image file generated included in the second quantization data from the counter and the reference value and outputs a control signal indicating that the control coefficient is again generated to the entropy coding circuit; the quantization coefficient generation circuit again generates a second quantization value based on the again generated control coefficient and the reference quantization coefficient; the quantization circuit quantizes an output signal of the compression circuit based on the again generated second quantization coefficient and outputs the quantization data to the entropy coding circuit; and the entropy coding circuit performs entropy coding on the quantization data based on the again generated second quantization coefficient upon receiving the control signal.
According to a second aspect of the present invention, there is provided an image compression controller for compressing image data to generate an image file having a size smaller than a set size, comprising a compression circuit for compressing redundancy of input image data for coding; a plurality of quantization circuits for first quantization based on a first quantization coefficient and second quantization based on a second quantization coefficient by a specific circuit on an output signal of the compression circuit; a plurality of counters for each counting the number of a quantization value having correlation with a size of an image file generated among quantization values included in at least first quantization data from the plurality of quantization circuits; a quantization coefficient control circuit for generating a plurality of reference control coefficients set to be different values for controlling the quantization coefficients of the plurality of quantization circuits and generating control coefficients based on counts of the plurality of counters and a reference value of the quantization value having correlation with a size of an image file generated set in advance; a quantization coefficient generation circuit for generating a plurality of first quantization values of different values based on a reference quantization coefficient set in advance and the plurality of reference control coefficients from the quantization control circuits and supplying the same to corresponding quantization circuits, generating the second quantization coefficient based on a control coefficient and the reference quantization coefficient, and supplying the same to one specific quantization circuit among the plurality of quantization circuits when receiving a control coefficient from the quantization coefficient control circuit; and an entropy coding circuit for entropy coding on the second quantization data from the quantization circuit which received the second quantization coefficient.
Preferably, a specific counter for counting a quantization value of quantization data of a specific quantization circuit to which the second quantization coefficient is supplied further counts the number of a quantization value having correlation with a size of an image file generated among quantization values included in the second quantization data from the specific quantization circuit; the quantization coefficient control circuit again generates a control coefficient based on the number of the quantization value having correlation with a size of an image file generated included in the second quantization data from the specific counter and the reference value and outputs a control signal indicating that the control coefficient is again generated to the entropy coding circuit; the quantization coefficient generation circuit again generates a second quantization coefficient based on the again generated control coefficient and the reference quantization coefficient and supplies it to the specific quantization circuit; the specific quantization circuit quantizes an output signal of the compression circuit based on the again generated second quantization coefficient and outputs the quantization data to the entropy coding circuit; and the entropy coding circuit performs entropy coding on quantization data based on the again generated second quantization coefficient upon receiving the control signal.
According to a third aspect of the present invention, there is provided an image pickup system, comprising an image pickup means for obtaining an image of an object; a signal processing circuit for converting image data from the image pickup means to digital data; and an image compression controller comprising; a compression circuit for compressing redundancy of the input image data for coding, a quantization circuit for first quantization based on a first quantization coefficient and second quantization based on a second quantization coefficient on an output signal of the compression circuit, a counter for counting the number of a quantization value having correlation with a size of an image file generated among quantization values included at least in the first quantization data from the above quantization circuit, a quantization coefficient control circuit for generating a control coefficient based on the count of the counter and a reference value of a quantization value having correlation with a size of an image file generated set in advance, a quantization coefficient generation circuit for supplying a reference quantization coefficient set in advance as the first quantization coefficient to the quantization circuit, generating the second quantization coefficient based on the control coefficient and the reference quantization coefficient, and supplying the same to the quantization circuit when receiving a control coefficient from the quantization coefficient control circuit, and an entropy coding circuit for entropy coding on the second quantization data from the quantization circuit.
According to a fourth aspect of the present invention, there is provided an image pickup s system, comprising an image pickup means for obtaining an image of an object; a signal processing circuit for converting image data from the image pickup means to digital data; and an image compression controller comprising a compression circuit for compressing redundancy of the digital image data from the above signal processing circuit for coding, a plurality of quantization circuits for first quantization based on a first quantization coefficient and second quantization based on a second quantization coefficient by a specific circuit on an output signal of the compression circuit, a plurality of counters for each counting the number of a quantization value having correlation with a size of an image file generated among quantization values included in at least first quantization data from the plurality of quantization circuits, a quantization coefficient control circuit for generating a plurality of reference control coefficients set to be different values for controlling the quantization coefficients of the plurality of quantization circuits and generating control coefficients based on counts of the plurality of counters and a reference value of the quantization value having correlation with a size of an image file generated set in advance, a quantization coefficient generation circuit for generating a plurality of first quantization values of different values based on a reference quantization coefficient set in advance and the plurality of reference control coefficients from the quantization control circuits and supplying the same to corresponding quantization circuits, generating the second quantization coefficient based on a control coefficient and the reference quantization coefficient, and supplying the same to one specific quantization circuit among the plurality of quantization circuits when receiving a control coefficient from the quantization coefficient control circuit, and an entropy coding circuit for entropy coding on the second quantization data from the quantization circuit which received the second quantization coefficient.
In each of the above aspects of the invention, there is further provided a memory for storing an output signal of the compression circuit and able to be accessed by the quantization circuits.
In each of the above aspects of the invention, the quantization value counted by the counter is xe2x80x9c0xe2x80x9d and the entropy coding circuit performs Huffman coding.
That is, according to the present invention, image data obtained by an image pickup means such as a CCD is supplied as digital data to a compression circuit.
In the compression circuit, the redundancy of the input image data is compressed and coded and the result is output to one or more quantization circuits.
In the quantization circuit, the quantization is performed by using a first quantization coefficient based on a reference quantization coefficient generated in the quantization coefficient generation circuit, and the first quantization data is supplied to a counter.
In the counter, a quantization value having a correlation with the size of the image file made, for example, the number xe2x80x9c0xe2x80x9d, among quantization values included in a first quantization data from the quantization circuit is counted, and the count is output to the quantization coefficient control circuit.
In the quantization coefficient control circuit, a control coefficient is generated based on the count of the counter and a reference value of a quantization value having correlation with a size of an image file generated set in advance and this is supplied to the quantization coefficient generation circuit.
In the quantization coefficient generation circuit supplied with the control coefficient, a second quantization coefficient is generated based on the control coefficient and reference quantization coefficient and it is supplied to a specific quantization circuit.
In the quantization circuit, the second quantization is performed based on a second quantization coefficient and the second quantization data is supplied to an entropy coding circuit for entropy coding.
Also, in the present invention, in a specific counter for counting a quantization value of quantization data of a specific quantization circuit supplied with a second quantization coefficient, the number of a quantization value having correlation with a size of an image file to be generated among the quantization values included in the second quantization data from the specific quantization circuit is further counted and the count is supplied to the quantization coefficient control circuit.
In the quantization coefficient control circuit, the control coefficient is reproduced based on the number of a quantization value having correlation with a size of an image file to be generated included in the second quantization data of the counter and a reference value and it is output to the quantization coefficient generation circuit and a control signal indicating that the control coefficient is reproduced is output to the entropy coding circuit.
In the quantization coefficient generation circuit a second quantization coefficient is reproduced based on the reproduced control coefficient and a reference quantization coefficient and it is supplied to a specific quantization circuit.
In the specific quantization circuit, the quantization is performed with respect to an output signal of the compression circuit based on the reproduced second quantization coefficient and the quantization data is output to the entropy coding circuit.
Then, in the entropy coding circuit, a control signal is received and entropy coding is performed with respect to on the quantization data based on the reproduced second quantization coefficient.
Also, in the present invention, the output signal of the compression circuit is stored in a memory. At the time of the second quantization or later, for example, the data stored in the memory is read by the quantization circuit, and the read data is quantized.